/*
 * @Author: your name
 * @Date: 2021-11-16 18:24:06
 * @LastEditTime: 2023-06-25 14:51:25
 * @LastEditors: liutongchao 1923236391@qq.com
 * @Description: 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 * @FilePath: \go_work\src\xiaoshuo\models\demo.go
 */
package models

import (
	_ "greenbeeadmin/models/commons"

	"github.com/beego/beego/v2/client/orm"
	_ "github.com/go-sql-driver/mysql" // import your used driver
)

type Role struct {
	Id        int    `json:"id"`
	CreatedAt string `json:"created_at"`
	UpdatedAt string `json:"updated_at"`
	DeletedAt string `json:"deleted_at" orm:"-"`
	Alias     string `json:"alias"`
	Label     string `json:"label"`
	Remark    string `json:"remark"`
	Sort      int8   `json:"sort"`
	Status    int8   `json:"status"`
	Is_del    int8   `json:"is_del"`
}

func init() {
	// register model 注册模型
	//orm.RegisterModel(new(AdminUser))
	orm.RegisterModelWithPrefix("go_", new(Role))
	// create table 参数二：true创建表     参数三：true更新表
	//orm.RunSyncdb("default", false, true)
}

// 设置引擎为 INNODB
func (u *Role) TableEngine() string {
	return "INNODB"
}

// 获取数据表名
func (u *Role) GetTableName() string {
	return "go_role"
}
